gpg: Allow import of PGP desktop exported secret keys.
authorWerner Koch <wk@gnupg.org>
Mon, 18 Mar 2019 12:07:14 +0000 (13:07 +0100)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 22 Aug 2019 19:11:59 +0000 (20:11 +0100)
commitd946ac98c64e272812c8e65f62eaf816e11084f4
tree8f0275a1e83e597635df208f92cf24609eabe10c
parent86459530b5b961b740ba77ae0a4956ee7f5b5ba9
gpg: Allow import of PGP desktop exported secret keys.

* g10/import.c (NODE_TRANSFER_SECKEY): New.
(import): Add attic kludge.
(transfer_secret_keys): Add arg only_marked.
(resync_sec_with_pub_keyblock): Return removed seckeys via new arg
r_removedsecs.
(import_secret_one): New arg r_secattic.  Change to take ownership of
arg keyblock.  Implement extra secret key import logic.  Factor some
code out to ...
(do_transfer): New.
(import_matching_seckeys): New.
--

The PGP desktops exported secret keys are really stupid.  And they
even a have kind of exception in rfc4880 which does not rule that
out (section 11.2):

  [...]  Implementations SHOULD include self-signatures on any user
  IDs and subkeys, as this allows for a complete public key to be
  automatically extracted from the transferable secret key.
  Implementations MAY choose to omit the self-signatures, especially
  if a transferable public key accompanies the transferable secret
  key.

Now if they would only put the public key before the secret
key. Anyway we now have a workaround for that ugliness.

GnuPG-bug-id: 4392
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 5205512fc092c53c0a52c8379ef2a129ce6e58a9)
(cherry picked from commit 0e73214dd208fca4df26ac796416c6f25b3ae50d)

Gbp-Pq: Topic from-2.2.14
Gbp-Pq: Name gpg-Allow-import-of-PGP-desktop-exported-secret-keys.patch
g10/import.c
g10/keyedit.c
g10/main.h